use proc_macro::TokenStream;
use syn::{parse_macro_input, DeriveInput};
mod builder;

#[proc_macro_derive(DbAccess, attributes(db_access))]
pub fn derive_entity(input: TokenStream) -> TokenStream {
    let input = parse_macro_input!(input as DeriveInput);
    match builder::BuilderContext::new(input) {
        Ok(t) => t.generate().into(),
        Err(e) => e.to_compile_error().into(),
    }
}

